package com.itheima.demo02;

import java.util.Scanner;
import java.util.TreeSet;

public class Demo01 {

    public static void main(String[] args) {

        TreeSet<Student> students = new TreeSet<>();



        for(int i=0; i<3; i++){

            Scanner sc = new Scanner(System.in);
            System.out.println("请输入第"+(i+1)+"个学生的姓名: ");
            String next = sc.next();

            System.out.println("请输入第"+(i+1)+"个学生的语文成绩: ");
            String next1 = sc.next();

            System.out.println("请输入第"+(i+1)+"个学生的数学成绩: ");
            String next2 = sc.next();

            System.out.println("请输入第"+(i+1)+"个学生的英语成绩: ");
            String next3 = sc.next();

            Student s = new Student();

            s.setName(next);
            s.setChineseScore(Integer.parseInt(next1));
            s.setMathScore(Integer.parseInt(next2));
            s.setEnglishScore(Integer.parseInt(next3));

            students.add(s);

        }

        students.forEach(student -> {
            System.out.println(student.getName()+"   "+student.getChineseScore()+"   "+student.getMathScore()+"   "+student.getEnglishScore()+"   "+student.getTotalScore());
        });
    }
}
